#include "refree_send.h"
#include "operate.h"
#include "IMU_Task.h"
#include "usart.h"

Data_Transmit_t Data_Transmit;

void Data_send(void)
{
    Data_Transmit.channal.FrameHeader.SOF = 0xA5;
    Data_Transmit.channal.FrameHeader.DataLenth = 26;
    Data_Transmit.channal.FrameHeader.Seq = 0x01;
    Append_CRC8_Check_Sum(Data_Transmit.Data,5);

    Data_Transmit.channal.CmdId = (uint16_t)0x0302;

    Data_Transmit.channal.Aix6.Pitch = Ax6.Ax6_R.rpy_P;
    Data_Transmit.channal.Aix6.Roll = Ax6.Ax6_R.rpy_R;
    Data_Transmit.channal.Aix6.Yaw = Ax6.Ax6_R.rpy_Y;
    Data_Transmit.channal.Aix6.Y_length = Ax6.Ax6_P.P_Y;
    Data_Transmit.channal.Aix6.X_length = Ax6.Ax6_P.P_X;
    Data_Transmit.channal.Aix6.Z_length = Ax6.Ax6_P.P_Z;
    Data_Transmit.channal.Aix6.CUP = HAL_GPIO_ReadPin(CUP_OPEN_GPIO_Port, CUP_OPEN_Pin);
    Data_Transmit.channal.Aix6.status = HAL_GPIO_ReadPin(STATUS_GPIO_Port, STATUS_Pin);

    Append_CRC16_Check_Sum(Data_Transmit.Data,35);

    HAL_UART_Transmit_DMA(&huart1,Data_Transmit.Data,35);
}

